<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>

<html>

	<head>

		<meta charset="utf-8" />

		<title>你办囍事 我送囍酒</title>

		<meta name="viewport" content="width=640,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="/Public/game/css/reset.css" />
		<link rel="stylesheet" type="text/css" href="<?php echo C('HTTP_HOST_URL');?>/Public/game/css/Ranking.css" />

	</head>

	<body>
		<?php
 $jssdk = new \JSSDK("wxfd8742a962585bcd", "1390437b5921430a49b529c4a79aba62"); $signPackage = $jssdk->GetSignPackage(); ?>

<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
    wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId:  '<?php echo $signPackage["appId"];?>', // 必填，公众号的唯一标识
        timestamp:<?php echo $signPackage["timestamp"];?>, // 必填，生成签名的时间戳
        nonceStr: '<?php echo $signPackage["nonceStr"];?>', // 必填，生成签名的随机串
        signature: '<?php echo $signPackage["signature"];?>',// 必填，签名，见附录1
        jsApiList: [
            'onMenuShareTimeline',
            'onMenuShareAppMessage'
        ] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
    });

    wx.ready(function () {
        initShareTimeline();
        initShareAppMessage();
//      music.play();
    });


/**
 * 初始化分享到朋友圈的设置
 */
function initShareTimeline(title,link,imgUrl){
	title= title?title:"<?php echo $BanquetUserInfo['name'];?>要结婚了，快来Ta的婚宴抢个座！";
	link= link?link:"<?php echo \Org\Net\Fun::url('home/page/table',array('id'=>$BanquetInfo['id'])); ?>";
	imgUrl = imgUrl?imgUrl:"<?php echo C('HTTP_HOST_URL');?>/Public/images/share.png";
    //分享到朋友圈
    wx.onMenuShareTimeline({
        title: title, // 分享标题
        link: link, // 分享链接
        imgUrl: imgUrl, // 分享图标
        trigger: function(res) {
		// 不要尝试在trigger中使用ajax异步请求修改本次分享的内容，因为客户端分享操作是一个同步操作，这时候使用ajax的回包会还没有返回
		//              alert('用户点击分享到朋友圈');
            
		},
		success: function(res) {
            <?php if($BanquetUserInfo['wx_id']==$userInfo['wx_id']):?>
            if(showwel){
            		try{
            			if (typeof(eval("showwel")) == "function") {
			           showwel(3);
			        }
            		}catch(e){
            			
            		}
            }
            
            <?php endif;?>
//			sharelog();
			///////////////////////////////////////////////
//			close_mask();
            
            
		},
		cancel: function(res) {
		},
		fail: function(res) {
		}
    });
}


/**
 * 初始化分享好友的设置
 */
function initShareAppMessage(title,desc,link,imgUrl){ 
	
	title= title?title:"<?php echo $BanquetUserInfo['name'];?>要结婚了，快来Ta的婚宴抢个座！";
	desc=desc?desc:"你办囍事，我送囍酒";
	link= link?link:"<?php echo \Org\Net\Fun::url('home/page/table',array('id'=>$BanquetInfo['id'])); ?>";
	imgUrl = imgUrl?imgUrl:"<?php echo C('HTTP_HOST_URL');?>/Public/images/share.png";
	//分享给朋友
    wx.onMenuShareAppMessage({
        title: title, // 分享标题
        desc: desc, // 分享描述
        link: link, // 分享链接
        imgUrl: imgUrl, // 分享图标
		trigger: function(res) {
            
			// 不要尝试在trigger中使用ajax异步请求修改本次分享的内容，因为客户端分享操作是一个同步操作，这时候使用ajax的回包会还没有返回
			//          alert('用户点击发送给朋友');
		},
		success: function(res) {
            <?php if($BanquetUserInfo['wx_id']==$userInfo['wx_id']):?>
             
        		try{
        			if (typeof(eval("showwel")) == "function") {
		           showwel(3);
		        }
        		}catch(e){
        			
        		}
            <?php endif;?>
//			sharelog();
			///////////////////////////////////////////////////////
//			close_mask();
            
		},
		cancel: function(res) {
		},
		fail: function(res) {
		}
    });
}
    
//提交分享记录    
function sharelog(){
	MYajax({"type":"share"},"/index.php/Home/app/share.html",function(res){})
}


//秘钥
var tokenkey = "lkasdj213489ulkjadsf";
function MYajax(requestData,url,successCallback){
	var requestData = requestData;
	var url = url;
	requestData = JSON.stringify(requestData);
	var requestKey = $.md5(requestData+tokenkey);
	$.ajax({
		type:"post",
		url:url,
		data:{'data':requestData,"key":requestKey},
		async:true,
		success:function(res){
			successCallback(res);
		},
		dataType:'json',
		fail:function(e){
			
		}
	});
}
</script>
		<div class="web">

			<!--******************头***********************-->

			<div class="top">

				<span>喜宴排行榜</span>

			</div>

			<!--******************中间***********************-->

			<div class="mid">

				<ul>

					<?php if(is_array($data)): foreach($data as $key=>$item): ?><li>

							<?php if($key < 3 ): ?><img src="/Public/game/images/Ranking_mid<?php echo $key+1;?>.png" /><?php endif; ?>

							<span><?php echo $key+1;?></span>

							<div><img src="<?php echo ($item["image"]); ?>" alt="" /></div>

							<span><?php echo ($item["name"]); ?></span>

							<h4>位宾客

							<p><?php echo ($item["people"]); ?></p>

						</h4>

						</li><?php endforeach; endif; ?>

					<!--

					<li>

						<span>2</span>

						<img src="/Public/game/images/Ranking_mid2.png"/>

						<div><img src="/Public/game/images/ranking_head.jpg" alt="" /></div>

						<span>XXXX</span>

						<h4>位宾客

							<p>30</p>

						</h4>

					</li>

					<li>

						<span>3</span>

						<img src="/Public/game/images/Ranking_mid3.png"/>

						<div><img src="/Public/game/images/ranking_head.jpg" alt="" /></div>

						<span>XXXX</span>

						<h4>位宾客

							<p>30</p>

						</h4>

					</li>

					<li>

						<span>4</span>

						<div><img src="/Public/game/images/ranking_head.jpg" alt="" /></div>

						<span>XXXX</span>

						<h4>位宾客

							<p>30</p>

						</h4>

					</li>

                    -->

				</ul>

			</div>

			<!--******************底部***********************-->

			<div class="bot">

				<button></button>

			</div>

		</div>

		<script src="<?php echo C('HTTP_HOST_URL');?>/Public/game/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>

		<script type="text/javascript">
			$(".bot button").on("click", function() {

				location.href = "<?php echo \Org\Net\Fun::url('home/page/index'); ?>";

			})
		</script>

	</body>

</html>